(function(){var t=window.BX;if(t.PhoneAuth)return;t.PhoneAuth=function(e){this.containerId=e.containerId;this.errorContainerId=e.errorContainerId;this.data=e.data;this.interval=60;if(e.interval){this.interval=e.interval}if(e.onError){this.onError=e.onError}t.ready(t.delegate(this.createLink,this))};t.PhoneAuth.prototype.createLink=function(){var e=t(this.containerId);if(e){var n=t.message("phone_auth_resend").replace(/#INTERVAL#/,'<span id="'+this.containerId+'_counter">'+this.interval+"</span>");e.innerHTML='<div id="'+this.containerId+'_text">'+n+"</div>\n"+'<div id="'+this.containerId+'_action" style="display:none"><a href="javascript:void(0)" id="'+this.containerId+'_link">'+t.message("phone_auth_resend_link")+"</a></div>";t(this.containerId+"_link").onclick=t.delegate(this.resendCode,this);this.startTimer()}};t.PhoneAuth.prototype.startTimer=function(){t(this.containerId+"_counter").textContent=this.interval;t(this.containerId+"_text").style.display="";t(this.containerId+"_action").style.display="none";t(this.errorContainerId).style.display="none";var e=setInterval(t.delegate(function(){var e=t(this.containerId+"_counter");var n=parseInt(e.textContent);if(n>0){n--}e.textContent=n},this),1e3);setTimeout(t.delegate(function(){clearInterval(e);t(this.containerId+"_text").style.display="none";t(this.containerId+"_action").style.display=""},this),this.interval*1e3)};t.PhoneAuth.prototype.resendCode=function(){t.ajax.runAction("main.phoneauth.resendCode",{data:this.data}).then(this.startTimer(),t.delegate(function(t){this.startTimer();if(this.onError){this.onError(t)}},this))}})();
//# sourceMappingURL=core_phone_auth.map.js